package tag27_18_08.streams;

import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;

public class St03_LesenSchreibenMehrereZeichen {

	public static void main(String[] args) throws IOException {

		File file = new File("text2");
		
		Writer out = new FileWriter(file);

		out.write("Zeile 1");
		
		out.close();
		
		System.out.println("Geschrieben");
		
		System.out.println("------ Lesen: -----------");
		Reader in = new FileReader(file);
		
		while(true) {
			int erg = in.read();
			
			if(erg==-1)
				break;
		
			System.out.print((char)erg);
		}
		
		in.close();
		
		System.out.println();
		System.out.println("Fertig");
		
	}

}
